The Database API > Database function overview |
![]() ![]() ![]() |
Database functions allow you to work with structured query language (SQL) statements and stored procedures. Using these functions, you can retrieve certain database schema information. A database schema is the structure of a database. (This structural information is also referred to as metadata.) The structure of a database includes the database's table and column names. With the database API functions, you can get table and column names from SQL statements and stored procedures, get user names and passwords used to establish database connections, and show the results of an executed SQL statement or stored procedure. These functions are used at design time when users are building their Web applications, as opposed to run time, when the Web application is deployed.
The database functions can be used by any extension. In fact, the UltraDev server behavior, data format, and data source API functions make use of the database functions.
The following example shows how the server behavior function, getDynamicBindings()
, is defined for Recordset. (The file, Recordset.js, is located in the /Configuration/ServerBehaviors/ASP folder.)
Notice that the MMDB.getColumnList()
function is used.
function getDynamicBindings(elementNode) { var ss = findSSrec(elementNode, LABEL_Type) var connString = ss.activeconnection var connName = ss.connectionName var statement = ss.source var rsName = ss.rsName var pa = new Array() if (String(ss.ParamArray) != "undefined") { for (var i = 0; i < ss.ParamArray.length; i++) { pa[i] = new Array() pa[i][0] = ss.ParamArray[i].name pa[i][1] = ss.ParamArray[i].value } } var statement = ReplaceParamsWithVals(statement, pa) return MMDB.getColumnList(connName, statement) }
![]() ![]() ![]() |